package net.esj.basic.core.engine.template.impl;

import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;

import net.esj.basic.core.engine.template.AbstractTemplateEngine;

public class VelocityTemplateEngine implements AbstractTemplateEngine<VelocityTemplate> {

	@Override
	public VelocityTemplate getTemplate(String temppath) throws Exception {
		Velocity.init(getClass().getResource("/").getPath());
		
		org.apache.velocity.Template template = null;
		
		template = Velocity.getTemplate(temppath);
		
		return new VelocityTemplate(template);
	}

}
